<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>礼物愿望详情 - 心愿社交</title>
    <!-- Bootstrap 5 CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome 图标 -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
    
    <style>
        :root {
            --primary: #6366f1; /* 主色调：靛蓝色 */
            --primary-light: #a5b4fc;
            --primary-dark: #4f46e5;
            --secondary: #ec4899; /* 辅助色：粉色 */
            --accent: #f59e0b; /* 强调色：橙色 */
            --success: #10b981; /* 成功色：绿色 */
            --danger: #ef4444; /* 危险色：红色 */
            --text-primary: #1f2937;
            --text-secondary: #6b7280;
            --bg-light: #f3f4f6;
            --bg-white: #ffffff;
            --border-light: #e5e7eb;
            --radius: 10px;
            --shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
        }
        
        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
            background-color: var(--bg-light);
            color: var(--text-primary);
            padding-top: 55px;
            padding-bottom: 70px;
        }
        
        /* 顶部导航 */
        .top-nav {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            height: 55px;
            background-color: var(--bg-white);
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 15px;
            z-index: 1000;
            border-bottom: 1px solid var(--border-light);
            box-shadow: var(--shadow);
        }
        
        .nav-title {
            font-size: 1.15rem;
            font-weight: 600;
            color: var(--primary-dark);
        }
        
        .nav-action {
            color: var(--text-secondary);
            background: none;
            border: none;
            font-size: 1.2rem;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .nav-action:hover {
            background-color: var(--bg-light);
        }
        
        /* 礼物详情卡片 */
        .gift-detail-card {
            background-color: var(--bg-white);
            border-radius: var(--radius);
            margin: 15px;
            overflow: hidden;
            box-shadow: var(--shadow);
        }
        
        /* 图片预览区 */
        .gift-image-preview {
            position: relative;
            width: 100%;
            background-color: #f9f9f9;
        }
        
        .image-container {
            width: 100%;
            overflow: hidden;
        }
        
        .main-image {
            width: 100%;
            height: auto;
            display: block;
        }
        
        .image-count {
            position: absolute;
            bottom: 10px;
            right: 10px;
            background-color: rgba(0, 0, 0, 0.5);
            color: white;
            padding: 2px 8px;
            border-radius: 12px;
            font-size: 0.8rem;
        }
        
        .thumbnail-strip {
            display: flex;
            padding: 8px;
            gap: 6px;
            overflow-x: auto;
            scrollbar-width: none;
            background-color: white;
            border-top: 1px solid var(--border-light);
        }
        
        .thumbnail-strip::-webkit-scrollbar {
            display: none;
        }
        
        .thumbnail-item {
            width: 60px;
            height: 60px;
            border-radius: 6px;
            overflow: hidden;
            flex: 0 0 auto;
            border: 2px solid transparent;
        }
        
        .thumbnail-item.active {
            border-color: var(--primary);
        }
        
        .thumbnail-item img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        
        /* 礼物信息区 */
        .gift-info {
            padding: 15px;
        }
        
        .gift-status {
            display: inline-block;
            padding: 3px 10px;
            border-radius: 12px;
            font-size: 0.75rem;
            font-weight: 500;
            margin-bottom: 8px;
        }
        
        .status-wishing {
            background-color: rgba(245, 158, 11, 0.1);
            color: var(--accent);
        }
        
        .status-received {
            background-color: rgba(16, 185, 129, 0.1);
            color: var(--success);
        }
        
        .gift-title {
            font-size: 1.3rem;
            font-weight: 600;
            margin-bottom: 10px;
            line-height: 1.4;
        }
        
        .gift-price {
            color: var(--danger);
            font-weight: 600;
            font-size: 1.1rem;
            margin-bottom: 15px;
            display: flex;
            align-items: center;
            gap: 5px;
        }
        
        .gift-description {
            font-size: 0.95rem;
            line-height: 1.6;
            color: var(--text-secondary);
            margin-bottom: 15px;
            padding-bottom: 15px;
            border-bottom: 1px solid var(--border-light);
        }
        
        .gift-meta {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            margin-bottom: 15px;
        }
        
        .gift-tag {
            background-color: rgba(99, 102, 241, 0.1);
            color: var(--primary);
            font-size: 0.8rem;
            padding: 3px 10px;
            border-radius: 12px;
        }
        
        .gift-meta-info {
            display: flex;
            justify-content: space-between;
            font-size: 0.85rem;
            color: var(--text-secondary);
            padding-top: 10px;
            border-top: 1px solid var(--border-light);
        }
        
        /* 发布者信息 */
        .publisher-info {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 15px;
            border-top: 1px solid var(--border-light);
        }
        
        .publisher-avatar {
            width: 45px;
            height: 45px;
            border-radius: 50%;
            object-fit: cover;
        }
        
        .publisher-details {
            flex: 1;
        }
        
        .publisher-name {
            font-weight: 500;
            margin-bottom: 2px;
        }
        
        .publish-time {
            font-size: 0.8rem;
            color: var(--text-secondary);
        }
        
        .follow-btn {
            padding: 6px 16px;
            border-radius: 20px;
            font-size: 0.85rem;
            font-weight: 500;
            background-color: var(--primary);
            color: white;
            border: none;
        }
        
        .follow-btn.following {
            background-color: var(--bg-light);
            color: var(--text-secondary);
        }
        
        /* 操作按钮区 */
        .action-buttons {
            display: flex;
            padding: 10px 15px;
            gap: 10px;
            background-color: var(--bg-white);
            margin: 0 15px 15px;
            border-radius: var(--radius);
            box-shadow: var(--shadow);
        }
        
        .primary-action {
            flex: 2;
            padding: 10px 0;
            border-radius: 25px;
            font-weight: 500;
            border: none;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            font-size: 0.95rem;
        }
        
        .primary-action.fulfill {
            background-color: var(--primary);
            color: white;
        }
        
        .primary-action.received {
            background-color: var(--success);
            color: white;
        }
        
        .secondary-action {
            flex: 1;
            padding: 10px 0;
            border-radius: 25px;
            font-weight: 500;
            border: 1px solid var(--border-light);
            background-color: white;
            color: var(--text-secondary);
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 5px;
            font-size: 0.9rem;
        }
        
        .secondary-action.active {
            color: var(--primary);
            border-color: var(--primary);
        }
        
        /* 评论区 */
        .comments-section {
            background-color: var(--bg-white);
            border-radius: var(--radius);
            margin: 0 15px 15px;
            overflow: hidden;
            box-shadow: var(--shadow);
        }
        
        .section-header {
            padding: 12px 15px;
            font-weight: 600;
            border-bottom: 1px solid var(--border-light);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .sort-comments {
            font-size: 0.85rem;
            color: var(--text-secondary);
            background: none;
            border: none;
            display: flex;
            align-items: center;
            gap: 5px;
        }
        
        .comments-list {
            max-height: 400px;
            overflow-y: auto;
        }
        
        .comment-item {
            padding: 15px;
            border-bottom: 1px solid var(--border-light);
        }
        
        .comment-header {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-bottom: 8px;
        }
        
        .comment-avatar {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            object-fit: cover;
        }
        
        .comment-author {
            font-weight: 500;
            font-size: 0.9rem;
        }
        
        .comment-time {
            font-size: 0.75rem;
            color: var(--text-secondary);
            margin-left: auto;
        }
        
        .comment-content {
            font-size: 0.9rem;
            line-height: 1.5;
            margin-bottom: 8px;
        }
        
        .comment-actions {
            display: flex;
            gap: 15px;
            font-size: 0.8rem;
        }
        
        .comment-action {
            color: var(--text-secondary);
            background: none;
            border: none;
            display: flex;
            align-items: center;
            gap: 3px;
        }
        
        .comment-action:hover, .comment-action.active {
            color: var(--primary);
        }
        
        /* 回复区域 */
        .replies-container {
            margin-left: 46px;
            margin-top: 10px;
        }
        
        .reply-item {
            padding: 8px 0;
            border-bottom: 1px solid var(--border-light);
        }
        
        .reply-item:last-child {
            border-bottom: none;
        }
        
        .reply-header {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 5px;
        }
        
        .reply-avatar {
            width: 28px;
            height: 28px;
            border-radius: 50%;
            object-fit: cover;
        }
        
        .reply-author {
            font-weight: 500;
            font-size: 0.85rem;
        }
        
        .reply-to {
            color: var(--primary);
        }
        
        .reply-time {
            font-size: 0.7rem;
            color: var(--text-secondary);
            margin-left: auto;
        }
        
        .reply-content {
            font-size: 0.85rem;
            line-height: 1.5;
            margin-bottom: 5px;
        }
        
        .reply-actions {
            display: flex;
            gap: 15px;
            font-size: 0.75rem;
        }
        
        /* 评论输入区 */
        .comment-input-container {
            padding: 12px 15px;
            background-color: var(--bg-white);
            position: relative;
        }
        
        .comment-input-wrap {
            display: flex;
            align-items: flex-end;
            gap: 10px;
        }
        
        .input-avatar {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            object-fit: cover;
            flex: 0 0 auto;
        }
        
        .comment-input-box {
            flex: 1;
            position: relative;
        }
        
        .comment-input {
            width: 100%;
            padding: 10px 12px;
            border: 1px solid var(--border-light);
            border-radius: 20px;
            font-size: 0.9rem;
            resize: none;
            height: 42px;
            overflow: hidden;
        }
        
        .comment-input:focus {
            outline: none;
            border-color: var(--primary-light);
        }
        
        .send-comment {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            background-color: var(--primary);
            color: white;
            border: none;
            display: flex;
            align-items: center;
            justify-content: center;
            flex: 0 0 auto;
        }
        
        .input-actions {
            position: absolute;
            right: 12px;
            bottom: 10px;
            display: flex;
            gap: 8px;
            color: var(--text-secondary);
        }
        
        .input-action {
            background: none;
            border: none;
            font-size: 1rem;
            color: inherit;
        }
        
        /* 回复输入框 */
        .reply-input-container {
            margin-left: 46px;
            margin-top: 10px;
            display: flex;
            align-items: flex-end;
            gap: 8px;
        }
        
        .reply-input {
            flex: 1;
            padding: 6px 10px;
            border: 1px solid var(--border-light);
            border-radius: 15px;
            font-size: 0.85rem;
            resize: none;
            height: 34px;
            overflow: hidden;
        }
        
        .reply-input:focus {
            outline: none;
            border-color: var(--primary-light);
        }
        
        .send-reply {
            width: 28px;
            height: 28px;
            border-radius: 50%;
            background-color: var(--primary);
            color: white;
            border: none;
            display: flex;
            align-items: center;
            justify-content: center;
            flex: 0 0 auto;
            font-size: 0.7rem;
        }
        
        /* 底部导航 */
        .bottom-nav {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            height: 60px;
            background-color: var(--bg-white);
            display: flex;
            justify-content: space-around;
            align-items: center;
            border-top: 1px solid var(--border-light);
            z-index: 1000;
        }
        
        .nav-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            color: var(--text-secondary);
            font-size: 0.7rem;
            text-decoration: none;
        }
        
        .nav-item i {
            font-size: 1.2rem;
            margin-bottom: 2px;
        }
        
        .nav-item.active {
            color: var(--primary);
        }
        
        /* 提示消息 */
        .toast-notification {
            position: fixed;
            bottom: 70px;
            left: 50%;
            transform: translateX(-50%);
            background-color: rgba(0, 0, 0, 0.7);
            color: white;
            padding: 7px 14px;
            border-radius: 4px;
            z-index: 9999;
            font-size: 0.85rem;
            opacity: 0;
            transition: opacity 0.3s ease;
        }
        
        .toast-notification.show {
            opacity: 1;
        }
        
        /* 已实现详情 */
        .fulfillment-details {
            background-color: rgba(16, 185, 129, 0.05);
            border-left: 3px solid var(--success);
            padding: 12px 15px;
            margin-bottom: 15px;
            border-radius: 0 var(--radius) var(--radius) 0;
        }
        
        .fulfillment-title {
            display: flex;
            align-items: center;
            gap: 8px;
            font-weight: 600;
            margin-bottom: 8px;
            color: var(--success);
            font-size: 0.95rem;
        }
        
        .fulfillment-content {
            font-size: 0.9rem;
            line-height: 1.5;
            color: var(--text-secondary);
        }
    </style>
</head>
<body>
    <!-- 顶部导航 -->
    <div class="top-nav">
        <button class="nav-action" id="backBtn">
            <i class="fas fa-arrow-left"></i>
        </button>
        <div class="nav-title">礼物详情</div>
        <button class="nav-action" id="shareBtn">
            <i class="fas fa-share-alt"></i>
        </button>
    </div>
    
    <!-- 礼物详情卡片 -->
    <div class="gift-detail-card">
        <!-- 图片预览区 -->
        <div class="gift-image-preview">
            <div class="image-container">
                <img src="https://picsum.photos/id/431/800/600" alt="手冲咖啡器具套装" class="main-image" id="mainImage">
                <div class="image-count">3/3</div>
            </div>
            
            <div class="thumbnail-strip">
                <div class="thumbnail-item active">
                    <img src="https://picsum.photos/id/431/100/100" alt="滤杯" data-img="https://picsum.photos/id/431/800/600">
                </div>
                <div class="thumbnail-item">
                    <img src="https://picsum.photos/id/493/100/100" alt="手冲壶" data-img="https://picsum.photos/id/493/800/600">
                </div>
                <div class="thumbnail-item">
                    <img src="https://picsum.photos/id/766/100/100" alt="磨豆机" data-img="https://picsum.photos/id/766/800/600">
                </div>
            </div>
        </div>
        
        <!-- 礼物信息区 -->
        <div class="gift-info">
            <span class="gift-status status-wishing">许愿中</span>
            
            <h1 class="gift-title">想要一套手冲咖啡器具套装</h1>
            
            <div class="gift-price">
                <i class="fas fa-rmb"></i>
                <span>预算: ¥150-200</span>
            </div>
            
            <div class="gift-description">
                最近对手冲咖啡很感兴趣，希望能有一套入门级的手冲套装，包含滤杯、手冲壶和磨豆机。最好是陶瓷材质的滤杯，手冲壶希望是细长嘴的，方便控制水流。磨豆机不需要太专业，入门级即可。预算在150-200元左右，希望能收到这套装备来提升我的咖啡体验。
            </div>
            
            <div class="gift-meta">
                <span class="gift-tag">家居用品</span>
                <span class="gift-tag">咖啡</span>
                <span class="gift-tag">生活方式</span>
                <span class="gift-tag">入门级</span>
            </div>
            
            <div class="gift-meta-info">
                <div>浏览 235</div>
                <div>收藏 42</div>
            </div>
        </div>
        
        <!-- 发布者信息 -->
        <div class="publisher-info">
            <img src="https://picsum.photos/id/64/100/100" alt="咖啡爱好者" class="publisher-avatar">
            <div class="publisher-details">
                <div class="publisher-name">咖啡爱好者</div>
                <div class="publish-time">发布于 2小时前</div>
            </div>
            <button class="follow-btn">关注</button>
        </div>
    </div>
    
    <!-- 操作按钮区 -->
    <div class="action-buttons">
        <button class="primary-action fulfill">
            <i class="fas fa-gift"></i>
            <span>帮他实现</span>
        </button>
        <button class="secondary-action like-btn">
            <i class="far fa-heart"></i>
            <span>24</span>
        </button>
        <button class="secondary-action save-btn">
            <i class="far fa-bookmark"></i>
            <span>收藏</span>
        </button>
    </div>
    
    <!-- 评论区 -->
    <div class="comments-section">
        <div class="section-header">
            <span>评论 (6)</span>
            <button class="sort-comments">
                <span>最新</span>
                <i class="fas fa-chevron-down"></i>
            </button>
        </div>
        
        <div class="comments-list">
            <!-- 评论1 -->
            <div class="comment-item">
                <div class="comment-header">
                    <img src="https://picsum.photos/id/26/100/100" alt="用户头像" class="comment-avatar">
                    <span class="comment-author">咖啡达人</span>
                    <span class="comment-time">1小时前</span>
                </div>
                <div class="comment-content">
                    我推荐HARIO的入门套装，价格适中，品质也不错，刚好在你的预算范围内。我自己用的就是这套，很适合新手。
                </div>
                <div class="comment-actions">
                    <button class="comment-action like-comment">
                        <i class="far fa-heart"></i>
                        <span>8</span>
                    </button>
                    <button class="comment-action reply-btn">
                        <i class="far fa-comment"></i>
                        <span>回复</span>
                    </button>
                </div>
                
                <!-- 回复区 -->
                <div class="replies-container">
                    <!-- 回复1 -->
                    <div class="reply-item">
                        <div class="reply-header">
                            <img src="https://picsum.photos/id/64/100/100" alt="用户头像" class="reply-avatar">
                            <span class="reply-author">咖啡爱好者</span>
                            <span class="reply-to">回复 咖啡达人</span>
                            <span class="reply-time">45分钟前</span>
                        </div>
                        <div class="reply-content">
                            谢谢推荐！我去看看这个牌子的套装~
                        </div>
                        <div class="reply-actions">
                            <button class="comment-action like-reply">
                                <i class="far fa-heart"></i>
                                <span>2</span>
                            </button>
                            <button class="comment-action reply-to-reply">
                                <i class="far fa-comment"></i>
                                <span>回复</span>
                            </button>
                        </div>
                    </div>
                </div>
                
                <!-- 回复输入框 (默认隐藏) -->
                <div class="reply-input-container" style="display: none;">
                    <img src="https://picsum.photos/id/91/100/100" alt="我的头像" class="reply-avatar">
                    <textarea class="reply-input" placeholder="回复 @咖啡达人..."></textarea>
                    <button class="send-reply">
                        <i class="fas fa-paper-plane"></i>
                    </button>
                </div>
            </div>
            
            <!-- 评论2 -->
            <div class="comment-item">
                <div class="comment-header">
                    <img src="https://picsum.photos/id/91/100/100" alt="用户头像" class="comment-avatar">
                    <span class="comment-author">文学爱好者</span>
                    <span class="comment-time">2小时前</span>
                </div>
                <div class="comment-content">
                    手冲咖啡确实很有意思，我之前也买了一套，现在每天早上都自己冲，比速溶咖啡好多了！
                </div>
                <div class="comment-actions">
                    <button class="comment-action like-comment">
                        <i class="far fa-heart"></i>
                        <span>5</span>
                    </button>
                    <button class="comment-action reply-btn">
                        <i class="far fa-comment"></i>
                        <span>回复</span>
                    </button>
                </div>
                
                <!-- 回复输入框 (默认隐藏) -->
                <div class="reply-input-container" style="display: none;">
                    <img src="https://picsum.photos/id/91/100/100" alt="我的头像" class="reply-avatar">
                    <textarea class="reply-input" placeholder="回复 @文学爱好者..."></textarea>
                    <button class="send-reply">
                        <i class="fas fa-paper-plane"></i>
                    </button>
                </div>
            </div>
            
            <!-- 评论3 -->
            <div class="comment-item">
                <div class="comment-header">
                    <img src="https://picsum.photos/id/22/100/100" alt="用户头像" class="comment-avatar">
                    <span class="comment-author">时尚搭配师</span>
                    <span class="comment-time">2小时前</span>
                </div>
                <div class="comment-content">
                    我知道有家店在做活动，这种套装打折后不到150元，需要的话可以发给你链接~
                </div>
                <div class="comment-actions">
                    <button class="comment-action like-comment">
                        <i class="far fa-heart"></i>
                        <span>3</span>
                    </button>
                    <button class="comment-action reply-btn">
                        <i class="far fa-comment"></i>
                        <span>回复</span>
                    </button>
                </div>
                
                <!-- 回复输入框 (默认隐藏) -->
                <div class="reply-input-container" style="display: none;">
                    <img src="https://picsum.photos/id/91/100/100" alt="我的头像" class="reply-avatar">
                    <textarea class="reply-input" placeholder="回复 @时尚搭配师..."></textarea>
                    <button class="send-reply">
                        <i class="fas fa-paper-plane"></i>
                    </button>
                </div>
            </div>
        </div>
        
        <!-- 评论输入区 -->
        <div class="comment-input-container">
            <div class="comment-input-wrap">
                <img src="https://picsum.photos/id/91/100/100" alt="我的头像" class="input-avatar">
                <div class="comment-input-box">
                    <textarea class="comment-input" placeholder="写下你的评论..."></textarea>
                    <div class="input-actions">
                        <button class="input-action"><i class="far fa-image"></i></button>
                        <button class="input-action"><i class="far fa-smile"></i></button>
                    </div>
                </div>
                <button class="send-comment">
                    <i class="fas fa-paper-plane"></i>
                </button>
            </div>
        </div>
    </div>
    
    <!-- 底部导航 -->
    <div class="bottom-nav">
        <a href="#" class="nav-item">
            <i class="fas fa-home"></i>
            <span>首页</span>
        </a>
        <a href="#" class="nav-item">
            <i class="fas fa-star"></i>
            <span>心愿墙</span>
        </a>
        <a href="#" class="nav-item active">
            <i class="fas fa-gift"></i>
            <span>礼物</span>
        </a>
        <a href="#" class="nav-item">
            <i class="far fa-user"></i>
            <span>我的</span>
        </a>
    </div>
    
    <!-- Bootstrap JS Bundle with Popper -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
    
    <script>
        // 提示消息
        function showToast(message) {
            let toast = document.querySelector('.toast-notification');
            if (toast) {
                toast.remove();
            }
            
            toast = document.createElement('div');
            toast.className = 'toast-notification';
            toast.textContent = message;
            
            document.body.appendChild(toast);
            
            setTimeout(() => {
                toast.classList.add('show');
            }, 10);
            
            setTimeout(() => {
                toast.classList.remove('show');
                setTimeout(() => toast.remove(), 300);
            }, 2500);
        }
        
        // 图片切换功能
        const thumbnails = document.querySelectorAll('.thumbnail-item');
        const mainImage = document.getElementById('mainImage');
        
        thumbnails.forEach(thumbnail => {
            thumbnail.addEventListener('click', () => {
                // 更新活跃状态
                thumbnails.forEach(t => t.classList.remove('active'));
                thumbnail.classList.add('active');
                
                // 切换主图
                const imgSrc = thumbnail.querySelector('img').getAttribute('data-img');
                mainImage.src = imgSrc;
            });
        });
        
        // 关注按钮功能
        const followBtn = document.querySelector('.follow-btn');
        followBtn.addEventListener('click', () => {
            if (followBtn.classList.contains('following')) {
                followBtn.classList.remove('following');
                followBtn.textContent = '关注';
                showToast('已取消关注');
            } else {
                followBtn.classList.add('following');
                followBtn.textContent = '已关注';
                showToast('关注成功');
            }
        });
        
        // 点赞功能
        const likeBtn = document.querySelector('.like-btn');
        likeBtn.addEventListener('click', () => {
            const icon = likeBtn.querySelector('i');
            const countElem = likeBtn.querySelector('span');
            let count = parseInt(countElem.textContent);
            
            if (icon.classList.contains('far')) {
                icon.classList.remove('far');
                icon.classList.add('fas');
                likeBtn.classList.add('active');
                countElem.textContent = count + 1;
                showToast('点赞成功');
            } else {
                icon.classList.remove('fas');
                icon.classList.add('far');
                likeBtn.classList.remove('active');
                countElem.textContent = count - 1;
                showToast('已取消点赞');
            }
        });
        
        // 收藏功能
        const saveBtn = document.querySelector('.save-btn');
        saveBtn.addEventListener('click', () => {
            const icon = saveBtn.querySelector('i');
            
            if (icon.classList.contains('far')) {
                icon.classList.remove('far');
                icon.classList.add('fas');
                saveBtn.classList.add('active');
                showToast('收藏成功');
            } else {
                icon.classList.remove('fas');
                icon.classList.add('far');
                saveBtn.classList.remove('active');
                showToast('已取消收藏');
            }
        });
        
        // 帮他实现按钮
        document.querySelector('.fulfill').addEventListener('click', () => {
            showToast('已发起帮助请求，等待对方回复');
        });
        
        // 评论点赞功能
        document.querySelectorAll('.like-comment').forEach(btn => {
            btn.addEventListener('click', function() {
                const icon = this.querySelector('i');
                const countElem = this.querySelector('span');
                let count = parseInt(countElem.textContent);
                
                if (icon.classList.contains('far')) {
                    icon.classList.remove('far');
                    icon.classList.add('fas');
                    this.classList.add('active');
                    countElem.textContent = count + 1;
                    showToast('点赞成功');
                } else {
                    icon.classList.remove('fas');
                    icon.classList.add('far');
                    this.classList.remove('active');
                    countElem.textContent = count - 1;
                    showToast('已取消点赞');
                }
            });
        });
        
        // 回复点赞功能
        document.querySelectorAll('.like-reply').forEach(btn => {
            btn.addEventListener('click', function() {
                const icon = this.querySelector('i');
                const countElem = this.querySelector('span');
                let count = parseInt(countElem.textContent);
                
                if (icon.classList.contains('far')) {
                    icon.classList.remove('far');
                    icon.classList.add('fas');
                    this.classList.add('active');
                    countElem.textContent = count + 1;
                    showToast('点赞成功');
                } else {
                    icon.classList.remove('fas');
                    icon.classList.add('far');
                    this.classList.remove('active');
                    countElem.textContent = count - 1;
                    showToast('已取消点赞');
                }
            });
        });
        
        // 回复按钮功能
        document.querySelectorAll('.reply-btn').forEach(btn => {
            btn.addEventListener('click', function() {
                const commentItem = this.closest('.comment-item');
                const replyInput = commentItem.querySelector('.reply-input-container');
                
                // 隐藏其他所有回复框
                document.querySelectorAll('.reply-input-container').forEach(input => {
                    if (input !== replyInput) {
                        input.style.display = 'none';
                    }
                });
                
                // 切换当前回复框显示状态
                replyInput.style.display = replyInput.style.display === 'none' ? 'flex' : 'none';
                
                if (replyInput.style.display === 'flex') {
                    replyInput.querySelector('.reply-input').focus();
                }
            });
        });
        
        // 回复的回复功能
        document.querySelectorAll('.reply-to-reply').forEach(btn => {
            btn.addEventListener('click', function() {
                const replyItem = this.closest('.reply-item');
                const commentItem = this.closest('.comment-item');
                const replyInput = commentItem.querySelector('.reply-input-container');
                
                // 隐藏其他所有回复框
                document.querySelectorAll('.reply-input-container').forEach(input => {
                    if (input !== replyInput) {
                        input.style.display = 'none';
                    }
                });
                
                // 设置回复对象
                const replyAuthor = replyItem.querySelector('.reply-author').textContent;
                replyInput.querySelector('.reply-input').placeholder = `回复 @${replyAuthor}...`;
                
                // 显示回复框并聚焦
                replyInput.style.display = 'flex';
                replyInput.querySelector('.reply-input').focus();
            });
        });
        
        // 发送回复功能
        document.querySelectorAll('.send-reply').forEach(btn => {
            btn.addEventListener('click', function() {
                const replyInput = this.parentElement.querySelector('.reply-input');
                const replyText = replyInput.value.trim();
                
                if (replyText) {
                    showToast('回复成功');
                    replyInput.value = '';
                    this.parentElement.style.display = 'none';
                    
                    // 这里可以添加代码将回复添加到回复列表
                }
            });
        });
        
        // 发送评论功能
        document.querySelector('.send-comment').addEventListener('click', function() {
            const commentInput = document.querySelector('.comment-input');
            const commentText = commentInput.value.trim();
            
            if (commentText) {
                showToast('评论成功');
                commentInput.value = '';
                // 自动调整输入框高度
                commentInput.style.height = '42px';
                
                // 这里可以添加代码将评论添加到评论列表
            }
        });
        
        // 自动调整评论输入框高度
        const commentInput = document.querySelector('.comment-input');
        commentInput.addEventListener('input', function() {
            this.style.height = 'auto';
            // 限制最大高度
            if (this.scrollHeight > 120) {
                this.style.height = '120px';
                this.style.overflowY = 'auto';
            } else {
                this.style.height = this.scrollHeight + 'px';
                this.style.overflowY = 'hidden';
            }
        });
        
        // 自动调整回复输入框高度
        document.querySelectorAll('.reply-input').forEach(input => {
            input.addEventListener('input', function() {
                this.style.height = 'auto';
                // 限制最大高度
                if (this.scrollHeight > 100) {
                    this.style.height = '100px';
                    this.style.overflowY = 'auto';
                } else {
                    this.style.height = this.scrollHeight + 'px';
                    this.style.overflowY = 'hidden';
                }
            });
        });
        
        // 评论排序功能
        document.querySelector('.sort-comments').addEventListener('click', function() {
            const currentSort = this.querySelector('span').textContent;
            const newSort = currentSort === '最新' ? '最热' : '最新';
            
            this.querySelector('span').textContent = newSort;
            showToast(`已按${newSort}排序`);
        });
        
        // 返回按钮
        document.getElementById('backBtn').addEventListener('click', () => {
            showToast('返回列表页');
        });
        
        // 分享按钮
        document.getElementById('shareBtn').addEventListener('click', () => {
            showToast('分享成功');
        });
    </script>
</body>
</html>

